<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <title><?php echo $store_name;?></title>
        <meta charset="UTF-8">
        <meta name="description" content="<?php echo $action['action_name'];?>">
        <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">
        <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
        <script type='text/javascript' src='/public/js/jquery-3.1.1.min.js'></script>
        <script type="text/javascript" src='/public/js/jquery.validate.js'></script>
        <script>
            var _hmt = _hmt || [];
            (function () {
                var hm = document.createElement("script");
                hm.src = "//hm.baidu.com/hm.js?8d43b5b5d798921b66d689f7a792e6e2";
                var s = document.getElementsByTagName("script")[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script type="text/javascript">
            document.domain = '<?php echo _DOMAIN_ALL_;?>';
        </script>
        <link rel="shortcut icon" type="image/ico" href="/favicon.ico">
    </head>
    <body class="_login_backimg" >
        <link href="/public/css/main.css" rel="stylesheet">
        <div class="container" style='font-size:10px;' >
            <div class='_main'>
                <div style='height:1.5rem'></div>
                <div class="_banner" >
                    <img src="/public/images/KAKA-LOGO.png" class="_banner_img"    alt='banner' />
                </div>
                <div class="login_div">
                    <form action='<?php echo buildUrl('/user/barber/sublogin');?>' method="post" id='login_form'>
                        <?php if($_GET["msg"]==1){?>
                        <div><font style="color:red">账号或验证码错误</font></div>
                        <?php }?>
                        <div class='form-group'>
                            <input type="text" class="form-control" id='account' name='account' placeholder="手机号" value="" style='border-color:#8A8C76;background:rgba(0,0,0,0);color:white;' />
                            <span id='check_mobile' style='color:red'> </span>
                        </div>
                        <div class='form-group' style="text-align: right">
                            <input type="text" class="form-control" name="code" id='code' placeholder="验证码" value="" style='float:left;width:17rem;border-color:#8A8C76;background:rgba(0,0,0,0);color:white;' />
                            <input type="button" id='subcode' class="form-control" onclick="_code();" style='float:right;border-color:#8A8C76;width:10rem;background:rgba(0,0,0,0);color:white;'  value="获取验证码"  >
                            <br style='clear:both' >
                            <div id='check_code' style='color:red;text-align:left;'> </div>
                        </div>
                        <div class="form-group login_sub" >
                            <input type="submit" class="btn btn-info form-control"  name="submit" value="登&nbsp;&nbsp;&nbsp;录" style='border-color:#8A8C76;background:rgba(0,0,0,0);color:white;'>
                        </div>
                    </form>
                    <div class="form-group login_sub" style="color:#999; margin:10rem  auto;" >唯美会互动科技（北京）有限公司</div>
                </div>
            </div>
        </div>
    </body>
</html>
<script type='text/javascript'>
    $("#login_form").validate({
        rules: {
            account: {
                required: true,
                number: true,
                mobile: true

            },
            code: {
                required: true,
                rangelength: [6, 6]
            }
        },
        messages: {
            account: {
                required: '请输入手机号',
                number: '请输入手机号',
                mobile: '请输入手机号'
            },
            code: {
                required: '请输入验证码',
                rangelength: '请输入验证码'
            }
        }
    });
    jQuery.validator.addMethod("mobile", function (value, element) {
        var length = value.length;
        var mobile = /^(((1[1-9]{1}[0-9]{1})|(15[0-9]{1}))+\d{8})$/
        return this.optional(element) || (length == 11 && mobile.test(value));
    }, "手机号码格式错误");

    function _code() {
        var mobile = $("#account").val();
        $.ajax({url: "/user/barber/code?mobile=" + mobile, async: true, success: function (msg) {
                if (msg != 'true') {
                    alert(msg);
                    return false;
                }
                $("#subcode").val('60');
                $("#subcode").attr('disabled', 'disabled');
                var t = setInterval(function () {
                    var m = $("#subcode").val();
                    var str = parseInt(m) - 1;
                    if (str <= 0) {
                        str = '获取验证码';
                        $("#subcode").removeAttr('disabled');
                        clearInterval(t);
                    }
                    $("#subcode").val(str);
                }, 1000);
            }
        });
    }
</script>